package com.example.springhelloworld.controller;

import com.example.springhelloworld.pojo.Student;
import com.example.springhelloworld.services.StudentAnnoService;
import com.example.springhelloworld.services.StudentService;
import com.example.springhelloworld.services.StudentServiceAnnoImpl;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class StudentAnnoController {

    @Resource
    private StudentAnnoService studentAnnoService;
    @GetMapping("/GetById")
    public Student s(Integer id){
        return studentAnnoService.queryById (id);
    }

    @GetMapping("/GetByName")
    public Student qn(String name){
        return studentAnnoService.queryByName(name);
    }

    @PostMapping("/add")
    public int addStudent(Student student){
        Student name = new Student(5, 5, 4, 4, "赵四");
        int i = studentAnnoService.addUser(name);
        return i;
    }

    @PutMapping("/update")
    public int updateStudent(int id){
        int i = studentAnnoService.updateStudent(id);
        return i;
    }

    @DeleteMapping("/delete")
    public int deleteStudent(int id){
        int i = studentAnnoService.deleteStudent(id);
        return i;
    }
}
